package com.itheima.reggie.config;


import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version 1.0
 * @Author 杨旭康
 * @Date 2022/10/31 11:16
 * @question: Mp拦截器制作  分页查询
 */

@Configuration
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {

        MybatisPlusInterceptor mpi = new MybatisPlusInterceptor();
        //分页
        mpi.addInnerInterceptor(new PaginationInnerInterceptor());
        //乐观锁
//        mpi.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return mpi;
    }



}
